package com.example.smartcity_ikun3.ui.Smart.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.smartcity_ikun3.R
import com.example.smartcity_ikun3.ui.Smart.adapter.SmartMoreThreeRecyclerViewAdapter
import com.example.smartcity_ikun3.ui.Smart.model.SmartThreeEntity
import kotlinx.android.synthetic.main.activity_smart_more_three.*

class SmartMoreThreeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        setContentView(R.layout.activity_smart_more_three)
        title = "巡检记录"

        // RecyclerView.adapter
        val array = ArrayList<SmartThreeEntity>().apply {
            this.add(SmartThreeEntity(
                "巡检时间: 2023-3-13",
                R.mipmap.smarttwo1,
                "7:30 : 牛奶",
                "12:00 : 2碗米饭",
                "14:30 : 下午茶",
                "17:30 : 1碗米饭",
                "饮食正常"))

            this.add(SmartThreeEntity(
                "巡检时间: 2023-3-14",
                R.mipmap.smarttwo1,
                "7:30 : 牛奶",
                "12:00 : 2碗米饭",
                "14:30 : 下午茶",
                "17:30 : 1碗米饭",
                "饮食正常"))

            this.add(SmartThreeEntity(
                "巡检时间: 2023-3-15",
                R.mipmap.smarttwo1,
                "7:30 : 牛奶",
                "12:00 : 2碗米饭",
                "14:30 : 下午茶",
                "17:30 : 1碗米饭",
                "饮食正常"))

            this.add(SmartThreeEntity(
                "巡检时间: 2023-3-16",
                R.mipmap.smarttwo1,
                "7:30 : 牛奶",
                "12:00 : 2碗米饭",
                "14:30 : 下午茶",
                "17:30 : 1碗米饭",
                "饮食正常"))

            this.add(SmartThreeEntity(
                "巡检时间: 2023-3-17",
                R.mipmap.smarttwo1,
                "7:30 : 牛奶",
                "12:00 : 2碗米饭",
                "14:30 : 下午茶",
                "17:30 : 1碗米饭",
                "饮食正常"))
        }


        SmartThreeRecyclerView.apply {
            this.layoutManager = LinearLayoutManager(context)
            this.adapter = SmartMoreThreeRecyclerViewAdapter(array)
        }
        
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        finish()
        return super.onOptionsItemSelected(item)
    }
}